interface IProduct
{
    doSomeThing():void;
}
interface IFactory
{
    creatProduct(value:string):IProduct;
}

class ConcreateProductA implements IProduct
{
    doSomeThing():void
    {
        console.log("Create Product A!");
    }
}
class ConCreateProductB implements IProduct
{
    doSomeThing():void
    {
        console.log("Create Product B!");
    }
}

class ProductFactory implements IFactory
{
      creatProduct(value:string):IProduct
      {
          switch(value)
          {
              case "ProductA":
              return new ConcreateProductA();
              case "ProductB":
              return new ConCreateProductB();
              default:
              return null;
          }
      }
}

export class FactoryMethodAction
{
    test()
    {
        const productA =  new ProductFactory().creatProduct("ProductA");
        productA.doSomeThing();
        const productB = new ProductFactory().creatProduct("ProductB");
        productB.doSomeThing();
    }
}

